package com.yekong.house.common.utils;

import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;

import java.nio.charset.Charset;


public class HashUtil {

    private static final HashFunction FUNCTION = Hashing.md5();

    //防止用户密码过于简单被暴力破解，将用户密码与一个字符串同时进行md5; 俗称加盐
    private static final String SALT = "yekong.com";

    public static String encryPassword(String password){
        HashCode hashCode = FUNCTION.hashString(password+SALT,Charset.forName("UTF-8"));
        return hashCode.toString();
    }

/*    public static void main(String[] args) {
        String password = "123456";
        System.out.println(encryPassword(password));
    }*/
}
